package com.system.xingzhi.controller;

import com.system.xingzhi.model.Page;
import com.system.xingzhi.model.ReturnData;
import com.system.xingzhi.model.Role;
import com.system.xingzhi.model.User;
import com.system.xingzhi.service.PageService;
import com.system.xingzhi.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController("/login")
@CrossOrigin
@Api(value = "/login",tags = {"登陆"},description = "用户登陆")
public class  LoginController {

    @Autowired
    private UserService userService;

    @GetMapping(value="/login")
    @ApiOperation(notes = "用户登陆",value = "用户登陆")
    public ReturnData login(@ApiParam(name = "userName",value = "账号") @RequestParam("userName") String userName,
                              @ApiParam(name = "password",value = "密码") @RequestParam("password") String password){
        Map<String,String> map=new HashMap<>();
        map.put("userName",userName);
        map.put("password",password);
        return  userService.login(map);
    }
//    @GetMapping(value="/logout")
//    @ApiOperation(notes = "删除页面",value = "删除页面")
//    public int deletePage(@ApiParam(name = "pageId",value = "页面id") @RequestParam("pageId") String pageId){
//        return  pageService.deleteByPrimaryKey(pageId);
//    }
}
